#!/usr/bin/env python
# test_tvm.py

__version__ = "$Revision: 1.4 $"
__author__  = 'Ramesh Balasubramanian <ramesh@finpy.org>'

import finpy
import unittest

class TvmTestCase(unittest.TestCase):
	def test_effrr(self):
		assert finpy.effrr(0.09, 12) == 0.0938
		assert finpy.effrr(0.09) == 0.0942
	
	def test_irr(self):
		assert finpy.irr([-100000,10000,20000,30000,40000,50000]) == 0.1201
	
	def test_npv(self):
		assert finpy.npv([-2000, 1000, 800, 600, 200], 0.1) == 157.64
		assert finpy.npv([-2000, 200, 600, 800, 1200], 0.1) == 98.35
		assert finpy.npv((-2000, 1000, 800, 600, 200), (0.08,0.1,0.12,0.14)) == \
			[235.1, 157.64, 84.78,16.17]
		
if __name__ == '__main__':
	unittest.main()